const OauthToken = require('../../util/token')
const randomString = require('../../util/noStr')
module.exports = [
  {
    /**
    * @api {get} /qq/login [/qq/login]
    * @apiGroup QQ
    * @apiPermission none
    */
    url: '/qq/login',
    method: 'get',
    request: (req, res) => {
      let data = {
        userId: '1187712426',
        echostr: randomString(16),
        name: 'qq'
      }
      // returns Promise
      console.log(req.session)
      OauthToken.create(data).then(oauthToken => {
        res.json(oauthToken)
      }).catch(error => {
        res.json(error)
      })
    }
  }
]
